<?php

use IDock\IDock\IDock;
use IDock\Printer\ProposalStatusPrinter;
use IDock\Visitor\EPolicyDownloadVisitor;
use IDock\Visitor\NonCar\NonCarInquiryVisitor;
use IDock\Visitor\PolicyInfoVisitor;
use IDock\Visitor\PolicyPaymentVisitor;
use IDock\Visitor\Premium\PremiumCarTaxVisitor;
use IDock\Visitor\Premium\PremiumChargingPileVisitor;
use IDock\Visitor\Premium\PremiumCoverageVisitor;
use IDock\Visitor\Premium\PremiumExtInfoVisitor;
use IDock\Visitor\Premium\PremiumInquiryVisitor;
use IDock\Visitor\Premium\PremiumNoCarVisitor;
use IDock\Visitor\Premium\PremiumPolicyVisitor;
use IDock\Visitor\Premium\PremiumRelationVisitor;
use IDock\Visitor\Premium\PremiumUnderwritingVisitor;
use IDock\Visitor\Premium\PremiumVehicleVisitor;
use IDock\Visitor\ProposalRecallVisitor;
use IDock\Visitor\ProposalStatusVisitor;
use IDock\Visitor\UnderwritingRecallVisitor;
use IDock\Visitor\UploadFileVisitor;
use IDock\Visitor\VehicleActualValueVisitor;
use IDock\Visitor\VehicleModelVisitor;

require_once('./vendor/autoload.php');

$IDock = new IDock();

$JTICConfig = [
    'gateway' => '*************',
    'logsDir' => '*************',
    'timeout' => '*************',
    'proxy' => '118.123.247.195:45131',
];

require_once('config.php');

$shortName = 'JTIC';

$IDock->setBean($shortName, $JTICConfig);

$vin = 'LSV2B8CA4HN504021';
$engineNo = 'P29015';
$licenseNo = '川A11SV2';
$firstRegisterDate = '2018-05-04';
$vehicleModel = 'DFL6440VAL2';

$biStartData = '2024-09-24 00:00:00';
$ciStartData = '2024-09-24 00:00:00';
$biEndData = '2025-09-24 00:00:00';
$ciEndData = '2025-09-24 00:00:00';

global $testResponse;

//$testResponse = '<xml encoding="utf-8"><returnCode>0</returnCode><returnMsg><![CDATA[通信成功]]></returnMsg><sign>9a910f8474b6949eb59b535046369b0d</sign><bizContent><![CDATA[<Packet><InterfaceMsg><ErrorCode>0000</ErrorCode><ErrorMessage>成功</ErrorMessage></InterfaceMsg><VehicleModelList><VehicleModelItem><VehicleId>MSCACD0027</VehicleId><VehicleName>萌山MSC9404CCY仓栅式半挂车</VehicleName><VehicleAlias></VehicleAlias><VehicleSeat>0</VehicleSeat><VehicleTonnage>33.8</VehicleTonnage><VehiclePrice>90000</VehiclePrice><VehicleExhaust></VehicleExhaust><VehicleType>国产</VehicleType><VehicleClass>特种车类</VehicleClass><QualityMax>6400</QualityMax><MarketaDate></MarketaDate><BrandId>MSC</BrandId><BrandName>萌山</BrandName><FamilyId>MSCAC</FamilyId><FamilyName>9400</FamilyName><NewEnergy>0</NewEnergy><Remark></Remark><ModelCode>BMSDBHUA0032</ModelCode></VehicleModelItem></VehicleModelList></Packet>]]></bizContent></xml>';
//$testResponse = '<xml encoding="utf-8"><returnCode>0</returnCode><returnMsg><![CDATA[通信成功]]></returnMsg><sign>755a6cdc990d366402a10b58faed8548</sign><bizContent><![CDATA[<Packet><InterfaceMsg><ErrorCode>0000</ErrorCode><ErrorMessage>成功</ErrorMessage></InterfaceMsg><VehicleModelList><VehicleModelItem><VehicleId>TYBARD0039</VehicleId><VehicleName>五菱LZW1029PYA货车</VehicleName><VehicleAlias></VehicleAlias><VehicleSeat>2</VehicleSeat><VehicleTonnage>.735</VehicleTonnage><VehiclePrice>38000</VehiclePrice><VehicleExhaust></VehicleExhaust><VehicleType>国产</VehicleType><VehicleClass>轻型货车类</VehicleClass><QualityMax>1105</QualityMax><MarketaDate></MarketaDate><BrandId>TYB</BrandId><BrandName>五菱</BrandName><FamilyId>TYBAR</FamilyId><FamilyName>1020</FamilyName><NewEnergy>0</NewEnergy><Remark>发动机型号:五菱L3C;底盘型号:五菱LZW1029PYA</Remark><ModelCode>BSQDWLUA0166</ModelCode></VehicleModelItem></VehicleModelList></Packet>]]></bizContent></xml>';
$testResponse = '<xml encoding="utf-8">
    <returnCode>0</returnCode>
    <returnMsg><![CDATA[通信成功]]></returnMsg>
    <sign>c76ceae38cdd4b401415da4dc047664b</sign>
    <bizContent>
        <Packet>
            <InterfaceMsg>
                <ErrorCode>0000</ErrorCode>
                <ErrorMessage>成功</ErrorMessage>
            </InterfaceMsg>
            <BasePart>
                <QtnId>1020101A33520245932318</QtnId>
                <TciQtnFlag>0</TciQtnFlag>
                <VciQtnFlag>1</VciQtnFlag>
                <AccQtnFlag>1</AccQtnFlag>
                <PropQtnFlag></PropQtnFlag>
                <CheckFlag>0</CheckFlag>
                <ReInsureFlag>1</ReInsureFlag>
                <PolicyRiskScore></PolicyRiskScore>
                <UnderwritingScore></UnderwritingScore>
                <MarketRatio></MarketRatio>
                <SumPrm></SumPrm>
            </BasePart>
            <ReInsure>
                <TCIReMessage>
                    交强投保查询与平台交互异常车险平台返回信息 号牌号码“川A5ZZ48”的保单发生重复投保，与其重复投保的其它公司的保单信息如下：投保确认码 02PICC510022120112195839384831;保单号 PDZA202251010001580796;起保日期 2023-01-08 00:00;终保日期 2024-01-08 00:00;号牌号码 川A5ZZ48;号牌种类 02;车架号 LGWFG8A62HH005664;发动机号 1743216922;地区 四川。
                </TCIReMessage>
                <TCIReExpireDate></TCIReExpireDate>
                <VCIReMessage>
                    车险平台返回信息 重复投保保单号： PDAA202251010001470234 保险公司代码：PICC 保险公司名称：中国人民财产保险股份有限公司 号牌号码：川A5ZZ48 号牌种类代码：02 号牌种类名称：小型汽车号牌 车架号：LGWFG8A62HH005664 发动机号：1743216922 签单日期：20221228 起保日期：202301090000 终保日期：202401090000 重复险别： 0301200 机动车损失保险; 0301600 机动车第三者责任保险; 0301701 机动车车上人员责任保险（司机）; 0301702 机动车车上人员责任保险（乘客）; 0301003 道路救援服务特约条款; 0301004 车辆安全检测特约条款; 0301005 代为驾驶服务特约条款; 0301006 代为送检服务特约条款;
                </VCIReMessage>
                <VCIReExpireDate></VCIReExpireDate>
            </ReInsure>
            <ApplicationTCI>
                <RenewalFlag>0</RenewalFlag>
                <RenewalInsFlag>0</RenewalInsFlag>
                <Premium></Premium>
                <LastYearClaimTimes>1</LastYearClaimTimes>
                <VehicleTax>
                    <TaxStartDate>20240101</TaxStartDate>
                    <TaxEndDate>20241231</TaxEndDate>
                    <AnnualTaxDue>300.0</AnnualTaxDue>
                    <SumTaxDefault>0.0</SumTaxDefault>
                    <SumOverdue>0.0</SumOverdue>
                    <SumTax>300.0</SumTax>
                </VehicleTax>
            </ApplicationTCI>
            <ApplicationVCI>
                <RenewalFlag>0</RenewalFlag>
                <RenewalInsFlag>0</RenewalInsFlag>
                <Premium></Premium>
                <SelfPricingCoef></SelfPricingCoef>
                <ClaimAdjustValue>1.0</ClaimAdjustValue>
                <ClaimAdjustLevel>0</ClaimAdjustLevel>
                <InsureYears>0</InsureYears>
                <ClaimTimes>0</ClaimTimes>
            </ApplicationVCI>
        </Packet>
    </bizContent>
</xml>';

//出单配置
if (0) {
    /*** @var $JTICConstruct \IDock\Insurance\JTIC\JTICConstruct */
    $JTICConstruct = $IDock->getBean($shortName);
    $response = $JTICConstruct->configInquiry();
    var_dump($response);
    exit;
}

//车辆车型查询接口
if (0) {
    //车辆车型查询接口
    $vehicleModelVisitor = new VehicleModelVisitor();
    //车架号
    $vehicleModelVisitor->vin = $vin;
    //发动机号
    $vehicleModelVisitor->engineNo = $engineNo;
    //车牌号
    $vehicleModelVisitor->licenseNo = $licenseNo;
    //初登时间
    $vehicleModelVisitor->firstRegisterDate = $firstRegisterDate;
    //车型编码
    $vehicleModelVisitor->vehicleModel = $vehicleModel;
    $vehicleModelVisitor->argc['DeptTeamCode'] = '0201230104';

    $response = $IDock->vehicleModel($shortName, $vehicleModelVisitor);
    var_dump($response->isSuccess());
    var_dump($response->getError());
    if ($response->isSuccess()) {
        /*** @var $printer \IDock\Printer\VehicleModelPrinter */
        $printer = $response->getPrinter();
        $printer = $response->getPrinter();
        if ($printer) var_dump($printer->toArray());
    }
    exit;
}

//车辆实际价格
if (0) {
    //车辆实际价格
    $vehicleActualValueVisitor = new VehicleActualValueVisitor();
    $vehicleActualValueVisitor->startDate = $biStartData;
    $vehicleActualValueVisitor->firstRegisterDate = $firstRegisterDate;
    //车辆价格
    $vehicleActualValueVisitor->vehiclePrice = '54800';
    //能源类型
    $vehicleActualValueVisitor->energyType = 'E01';
    //是否新能源
    $vehicleActualValueVisitor->isNewEnergy = false;
    //使用性质
    $vehicleActualValueVisitor->useNatureCode = '01';
    //车辆用途
    $vehicleActualValueVisitor->causeType = '001';
    //车辆种类
    $vehicleActualValueVisitor->carKindCode = '100';
    //座位数
    $vehicleActualValueVisitor->vehicleSeat = '5';
    //荷载质量
    $vehicleActualValueVisitor->vehicleTonnage = '0';

    $response = $IDock->vehicleActualValue($shortName, $vehicleActualValueVisitor);
    var_dump($response->isSuccess());
    var_dump($response->getError());

    /**
     * @var $printer \IDock\Printer\VehicleActualValuePrinter
     */
    $printer = $response->getPrinter();
    var_dump($printer->toArray());
    exit;
}

//询价前置
//保费计算
//核保
if (1) {

    /**
     * 询价主信息
     */
    $premiumInquiryVisitor = new PremiumInquiryVisitor();
    //商业险起保日期
    $premiumInquiryVisitor->biStartData = $biStartData;
    //商业险终保日期
    $premiumInquiryVisitor->biEndData = $biEndData;
    //交强险起保日期
    $premiumInquiryVisitor->ciStartData = $ciStartData;
    //交强险终保日期
    $premiumInquiryVisitor->ciEndData = $ciEndData;
    //商业险即时生效
    $premiumInquiryVisitor->biEffectFlag = false;
    //交强险即时生效
    $premiumInquiryVisitor->ciEffectFlag = false;

    $premiumInquiryVisitor->isNewEnergy = false;

    /**
     * 车辆信息
     */
    $premiumVehicleVisitor = new PremiumVehicleVisitor();
    //是否新车
    $premiumVehicleVisitor->isNewVehicle = '1';
    //车架号
    $premiumVehicleVisitor->vin = $vin;
    //发动机号
    $premiumVehicleVisitor->engineNo = $engineNo;
    //车牌号
    $premiumVehicleVisitor->licenseNo = $licenseNo;
    //初登时间
    $premiumVehicleVisitor->firstRegisterDate = $firstRegisterDate;
    //过户时间
    $premiumVehicleVisitor->transferDate = '';
    //是否过户车
    $premiumVehicleVisitor->isTransfer = '0';
    //发证时间
    $premiumVehicleVisitor->issueDate = '';
    //车型编码
    $premiumVehicleVisitor->vehicleModel = $vehicleModel;
    //车型编码代码
    $premiumVehicleVisitor->vehicleModelCode = 'DZABJD0007';
    //$premiumVehicleVisitor->vehicleModelCode = 'BTYOSPUB0014';
    //车型名称
    $premiumVehicleVisitor->vehicleName = '丰田TV7152X轿车';
    //车价
    $premiumVehicleVisitor->vehiclePrice = '85535';
    //车价含税
    $premiumVehicleVisitor->vehiclePriceTax = '85535';
    //协商价格
    $premiumVehicleVisitor->actualValue = '82968.95';
    //座位数
    $premiumVehicleVisitor->vehicleSeat = '5';
    //使用性质
    $premiumVehicleVisitor->useNatureCode = '01';
    //所属性质
    $premiumVehicleVisitor->attachNature = '01';
    //车辆用途
    $premiumVehicleVisitor->causeType = '001';
    //车辆种类
    $premiumVehicleVisitor->carKindCode = '100';
    //能源类型代码
    $premiumVehicleVisitor->energyTypeCode = 'E01';
    //号牌颜色代码
    $premiumVehicleVisitor->licenseColorCode = '01';
    //号牌种类代码
    $premiumVehicleVisitor->licenseTypeCode = '02';
    //交管车辆类型代码
    $premiumVehicleVisitor->vehicleStyleCode = 'K33';
    //功率
    $premiumVehicleVisitor->power = '79.0';
    //排量
    $premiumVehicleVisitor->vehicleExhaust = '1.496';
    //整备质量
    $premiumVehicleVisitor->wholeWeight = '10.2';
    //荷载质量
    $premiumVehicleVisitor->vehicleTonnage = '0.0';
    //进口标识
    $premiumVehicleVisitor->vehicleImport = 'I2';
    //是否能源车
    $premiumVehicleVisitor->isNewEnergy = '0';
    //纯电续航里程(公里)
    $premiumVehicleVisitor->pureRange = '';
    //车辆来历凭证编号
    $premiumVehicleVisitor->carCertificateNo = '';
    //开具车辆来历凭证所载日期
    $premiumVehicleVisitor->carCertificateDate = '';
    //车辆来历凭证种类代码
    $premiumVehicleVisitor->carCertificateType = '';

    /**
     * 关系人
     */
    $premiumRelationVisitor = new PremiumRelationVisitor();
    //姓名
    $premiumRelationVisitor->name = '廖皓';
    //联系方式
    $premiumRelationVisitor->mobile = '13550217453';
    //类型
    $premiumRelationVisitor->typeCode = 'R1';
    //证件类型
    $premiumRelationVisitor->certificateTypeCode = '01';
    //证件号码
    $premiumRelationVisitor->certificateNo = '51390219960714105X';
    //地址
    $premiumRelationVisitor->address = '四川省成都市龙泉驿区龙泉车城西一路185号1栋1单元20楼2001号';
    //邮箱
    $premiumRelationVisitor->email = '18982272991@qq.com';
    //证件有效期
    $premiumRelationVisitor->certificateStartDate = '2000-01-01';
    //证件失效期
    $premiumRelationVisitor->certificateEndDate = '2050-01-01';

    /**
     * 缴税信息
     */
    $premiumCarTaxVisitor = new PremiumCarTaxVisitor();
    //缴税内心
    $premiumCarTaxVisitor->taxTypeCode = 'T01';
    //纳税人姓名
    $premiumCarTaxVisitor->taxpayerName = '樊鑫';
    //纳税人证件类型
    $premiumCarTaxVisitor->taxpayerCertificateTypeCode = '01';
    //纳税人证件号码
    $premiumCarTaxVisitor->taxpayerCertificateNo = '51390219960714105X';
    //纳税人电话
    $premiumCarTaxVisitor->taxpayerPhone = '13550217453';
    //纳税起期
    $premiumCarTaxVisitor->taxStartDate = '2023-08-10 00:00:00';
    //纳税止期
    $premiumCarTaxVisitor->taxEndDate = '2024-08-09 23:59:59';
    //减免税方案代码
    $premiumCarTaxVisitor->taxReductionCode = '';
    //减免税原因代码
    $premiumCarTaxVisitor->taxReductionReasonCode = '';
    //税务机关名称
    $premiumCarTaxVisitor->taxDepartment = '';
    //税务机关代码
    $premiumCarTaxVisitor->taxDepartmentCode = '';
    //开具完税凭证地区代码
    $premiumCarTaxVisitor->taxPaidAreaCode = '';
    //完税凭证填发日期
    $premiumCarTaxVisitor->taxDocumentDate = '';
    //减免比例 百分比
    $premiumCarTaxVisitor->taxFreeRate = '';
    //减税金额 元
    $premiumCarTaxVisitor->taxExemption = '';
    //减免完税凭证号
    $premiumCarTaxVisitor->taxDocumentNumber = '';

    //险种

    //
    $premiumCoverageVisitor = new PremiumCoverageVisitor();
    $premiumCoverageVisitor->coverageCode = 'C01001';
    $premiumCoverageVisitor->amount = '200000';

//        $premiumCoverageVisitor1 = new PremiumCoverageVisitor();
//        $premiumCoverageVisitor1->coverageCode = 'C05001';
//        $premiumCoverageVisitor1->amount = '40000';
//        $premiumCoverageVisitor1->unitAmount = '10000';
////        $premiumCoverageVisitor1->deductionRate = '5';
////
//        $premiumCoverageVisitor2 = new PremiumCoverageVisitor();
//        $premiumCoverageVisitor2->coverageCode = 'C03001';
//        $premiumCoverageVisitor2->amount = '1000000';
////        $premiumCoverageVisitor2->deductionRate = '5';
//
//        $premiumCoverageVisitor3 = new PremiumCoverageVisitor();
//        $premiumCoverageVisitor3->coverageCode = 'C02001';
//        $premiumCoverageVisitor3->amount = '109409.8';


    //新能源充电桩信息
    $premiumChargingPileVisitor = new PremiumChargingPileVisitor();

    $premiumChargingPileVisitor->seqNo = '1';
    //充电桩类型
    $premiumChargingPileVisitor->chargingPileKind = 'PK1';
    //充电桩安装地点类型
    $premiumChargingPileVisitor->chargingPileAddressType = 'PA1';
    //充电桩使用年限
    $premiumChargingPileVisitor->chargingPileYearLimit = 'PY1';
    //充电桩编码
    $premiumChargingPileVisitor->chargingPileCode = '123456';
    //充电桩型号
    $premiumChargingPileVisitor->chargingPileType = 'BCS100500';
    //充电桩地址
    $premiumChargingPileVisitor->chargingPileAddress = '地面充电桩';
    //损失保险保额
    $premiumChargingPileVisitor->lossAmount = '';
    //责任保险保额
    $premiumChargingPileVisitor->liabilityAmount = '10000';

    /**
     * 拓展信息
     */
    $premiumExtInfoVisitor = new PremiumExtInfoVisitor();
    //验车情况
    $premiumExtInfoVisitor->carCheckCode = 'CS3';//已验
    //免验原因
    $premiumExtInfoVisitor->carCheckReasonKind = '';
    //验车人
    $premiumExtInfoVisitor->carChecker = '张三';
    //验车日期
    $premiumExtInfoVisitor->carCheckDate = '2023-08-02';
    //验车地点
    $premiumExtInfoVisitor->carAddress = '';
    //是否送修
    $premiumExtInfoVisitor->isMonopoly = '0';
    //送修代码
    $premiumExtInfoVisitor->repairCode = '';
    //送修名称
    $premiumExtInfoVisitor->repairName = '';
    //自主定价系数
    $premiumExtInfoVisitor->selfPricingFactor = '';
    //自主核保系数
    $premiumExtInfoVisitor->underwritingFactor = '';
    //期望折扣
    $premiumExtInfoVisitor->expectedDiscount = '';
    //是否贷款车
    $premiumExtInfoVisitor->isLoanCar = '';
    //贷款机构名称
    $premiumExtInfoVisitor->loanOrg = '';

    //珠峰拓展

    $premiumExtInfoVisitor->argc['platOrderNo'] = 'C20231201110525912000207270';
    $premiumExtInfoVisitor->argc['businessNo'] = 'HX202312011105255951';


    //添加车辆信息
    $premiumInquiryVisitor->setVehicleVisitor($premiumVehicleVisitor);
    //添加投保人
    $premiumInquiryVisitor->setApplicantVisitor($premiumRelationVisitor);
    //添加被保人
    $premiumInquiryVisitor->setInsuredVisitor($premiumRelationVisitor);
    //添加车主
    $premiumInquiryVisitor->setOwnerVisitor($premiumRelationVisitor);
    //车船税
    $premiumInquiryVisitor->setCarTaxVisitor($premiumCarTaxVisitor);

    /**
     * 非车列表
     */
    $nonCarInquiryVisitor = new NonCarInquiryVisitor();
    ////投保份数
    //$nonCarInquiryVisitor->setApplicantVisitor($premiumInquiryVisitor->getApplicantVisitor());
    ////产品代码
    //$nonCarInquiryVisitor->prodCode = '';
    ////方案代码
    //$nonCarInquiryVisitor->schemeCode = '';
    ////每份保额
    //$nonCarInquiryVisitor->prePremium = '';
    ////总保费
    //$nonCarInquiryVisitor->sumPremium = '';

    //险种添加
//        $premiumInquiryVisitor->coverageVisitorAppend($premiumCoverageVisitor1);
//        $premiumInquiryVisitor->coverageVisitorAppend($premiumCoverageVisitor2);
//        $premiumInquiryVisitor->coverageVisitorAppend($premiumCoverageVisitor3);
    $premiumInquiryVisitor->coverageVisitorAppend($premiumCoverageVisitor);
    //新能源充电桩
//        $premiumInquiryVisitor->chargingPileVisitorAppend($premiumChargingPileVisitor);
    //拓展信息
    $premiumInquiryVisitor->setExtInfoVisitor($premiumExtInfoVisitor);
    //非车信息
    $premiumInquiryVisitor->setNonCarInquiryVisitor($nonCarInquiryVisitor);
    $premiumInquiryVisitor->setNonCarUnderwritingVisitor($nonCarInquiryVisitor);

    //询价前置
//        $response = $IDock->preInquiry($shortName, $premiumInquiryVisitor);
//        var_dump($response->isSuccess());
//        var_dump($response->getError());
//        /**
//         * @var $printer \IDock\Printer\preInquiryPrinter;
//         */
//        $printer = $response->getPrinter();
//        var_dump($printer->toArray());
//        exit;

    //询价
    $response = $IDock->premiumInquiry($shortName, $premiumInquiryVisitor);
    var_dump($response->isSuccess());
    var_dump($response->getError());

    /**
     * @var $printer \IDock\Printer\Premium\PremiumInquiryPrinter;
     */
    $printer = $response->getPrinter();
    if ($printer) {
        var_dump($printer->toArray());
    }
//
    exit;

    /**
     * 核保信息
     */
    $premiumUnderwritingVisitor = new PremiumUnderwritingVisitor();
    $premiumUnderwritingVisitor->biInquiryNo = '';
    $premiumUnderwritingVisitor->ciInquiryNo = '';

    $premiumUnderwritingVisitor->agreement = [];

    $premiumInquiryVisitor->setUnderwritingVisitor($premiumUnderwritingVisitor);
    //核保
    $response = $IDock->underwriting($shortName, $premiumInquiryVisitor);

    var_dump($response->isSuccess());
    var_dump($response->getError());

    /**
     * @var $printer \IDock\Printer\PremiumUnderwritingPrinter;
     */
    $printer = $response->getPrinter();

    if ($printer) var_dump($printer->toArray());
    exit;
}

//支付
if (0) {
    $policyPaymentVisitor = new PolicyPaymentVisitor();
    $policyPaymentVisitor->inquiryNo = '599510803602023000184';
    $policyPaymentVisitor->biInquiryNo = '';
    $policyPaymentVisitor->ciInquiryNo = '599510803602023000184';
    $response = $IDock->policyPayment($shortName, $policyPaymentVisitor);

    var_dump($response->isSuccess());
    var_dump($response->getError());
    /**
     * @var $printer \IDock\Printer\PolicyPaymentPrinter
     */
    $printer = $response->getPrinter();

    var_dump($printer->toArray());
    exit;
}

//影像资料上传
if (0) {
    $uploadFileVisitor = new UploadFileVisitor();
    $uploadFileVisitor->inquiryNo = 'M232010136320230000010';
    $uploadFileVisitor->biInquiryNo = 'T232010080820230000014';
    $uploadFileVisitor->ciInquiryNo = 'T232010080120230000010';

    $appType = 'G_HX';//一级代理和二级代理
    $orgNum = '07000002';//出单机构
    $oprId = '00000020';//操作员编码
    $upType = '2';//上传方式 1（文件流），2（ftp）
    $imageList = [
        [
            'imgName' => 'test111.jpg',//要求英文
//                'base64Img' => base64_encode(file_get_contents(__DIR__ . '/test.jpg')),//图片base64编码
            'filedSuffix' => 'jpg',//文件后缀
            'filedPath' => 'https://p0.itc.cn/q_70/images03/20220512/77ed76720a1f40ef94948761dda05655.jpeg',//图片地址 ftp模式必传
        ],
    ];
    foreach ($imageList as $val) {
        $uploadFileVisitor->fileAppend('10017', $val['filedPath'], '');
    }
    $uploadFileVisitor->argc['isNewCar'] = 1;
    $uploadFileVisitor->argc['platOrderNo'] = 'C20230816095559578000106043';

    $response = $IDock->UploadFile($shortName, $uploadFileVisitor);

    var_dump($response->isSuccess());
    var_dump($response->getError());

    /**
     * @var  $printer \IDock\Printer\UploadFilePrinter
     */
    $printer = $response->getPrinter();

    if (!empty($printer)) var_dump($printer->toArray());
    exit;
}

//投保单查询
if (0) {
    $proposalStatusVisitor = new ProposalStatusVisitor();

    $proposalStatusVisitor->inquiryNo = '599510803602023000279';
    $proposalStatusVisitor->biInquiryNo = '';
    $proposalStatusVisitor->ciInquiryNo = '599510803602023000279';
    $proposalStatusVisitor->argc['platOrderNo'] = '111';
    $response = $IDock->proposalStatus($shortName, $proposalStatusVisitor);

    var_dump($response->isSuccess());
    var_dump($response->getError());

    /*** @var $printer ProposalStatusPrinter; */
    $printer = $response->getPrinter();

    var_dump($printer);
    exit;
}

//撤单
if (0) {
    $proposalRecallVisitor = new ProposalRecallVisitor();

    $proposalRecallVisitor->inquiryNo = '599510803682023000036';
    $proposalRecallVisitor->biInquiryNo = '';
    $proposalRecallVisitor->ciInquiryNo = '599510803682023000036';
    $proposalRecallVisitor->reason = '客户注销';
    $proposalRecallVisitor->argc['OrgCode'] = '51080503';

    $response = $IDock->proposalRecall($shortName, $proposalRecallVisitor);

    var_dump($response->isSuccess());
    var_dump($response->getError());

    /**
     * @var $printer \IDock\Printer\ProposalRecallPrinter
     */
    $printer = $response->getPrinter();
    var_dump($printer->toArray());
    exit;
}

//核保撤单
if (0) {
    $underwritingRecallVisitor = new UnderwritingRecallVisitor();

    $underwritingRecallVisitor->inquiryNo = 'M232010136320230000010';
    $underwritingRecallVisitor->biInquiryNo = 'T232010080820230000014';
    $underwritingRecallVisitor->ciInquiryNo = 'T232010080120230000010';
    $underwritingRecallVisitor->reason = '投保注销';
    $underwritingRecallVisitor->argc['OrgCode'] = '51080503';


    $underwritingRecallVisitor->argc['platOrderNo'] = 'C20230816095559578000106043';

    $response = $IDock->underwritingRecall($shortName, $underwritingRecallVisitor);

    var_dump($response->isSuccess());
    var_dump($response->getError());

    /**
     * @var $printer \IDock\Printer\UnderwritingRecallPrinter
     */
    $printer = $response->getPrinter();
    if (!empty($printer)) var_dump($printer->toArray());
    exit;

}

//电子保单下载
if (0) {
    $EPolicyDownloadVisitor = new EPolicyDownloadVisitor();

    $EPolicyDownloadVisitor->policyNo = '204000103612024000017';

    $response = $IDock->EPolicyDownload($shortName, $EPolicyDownloadVisitor);

    var_dump($response->isSuccess());
    var_dump($response->getError());


    /**
     * @var $printer \IDock\Printer\EPolicyDownloadPrinter
     */
    $printer = $response->getPrinter();
    var_dump($printer);
    exit;
}

//保单详情
if (0) {
    $policyInfoVisitor = new PolicyInfoVisitor();

    $policyInfoVisitor->policyNo = 'C20230816095559578000106043';
    $policyInfoVisitor->argc['platOrderNo'] = 'C20230816095559578000106043';
    $response = $IDock->policyInfo($shortName, $policyInfoVisitor);
    var_dump($response->isSuccess());
    var_dump($response->getError());
    var_dump($response->getPrinter()->toArray());
    exit;
}

//非车保单详情
if (1) {
    $policyInfoVisitor = new PolicyInfoVisitor();

    $policyInfoVisitor->policyNo = 'C20230816095559578000106043';
    $policyInfoVisitor->argc['platOrderNo'] = 'C20230816095559578000106043';
    $demo = $IDock->getBean($shortName);
    $response = $demo->nonCarPolicyInfo($policyInfoVisitor);
    var_dump($response->isSuccess());
    var_dump($response->getError());
    var_dump($response->getPrinter()->toArray());
    exit;
}
